package com.it.you.base.list;

import com.it.you.pojo.UserPO;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class ListTest5 {
    public static void main(String[] args) {
        List<UserPO> poList = new ArrayList<>();
        poList.add(new UserPO("zhang三", 12, "01", 100.2, "北京"));
        poList.add(new UserPO("李四", 18, "01", 990.2, "北京"));
        poList.add(new UserPO("王五", 15, "02", 45.8, "深圳"));
        poList.add(new UserPO("八戒", 8, "02", 1000.8, "上海"));
        poList.add(new UserPO("悟空", 9, "02", 100.2, "上海"));
        poList.add(new UserPO("小红", 12, "01", 50.2, "上海"));

        List<String> list1 = new ArrayList<>();
        list1.add("01");
        List<UserPO> poList1 = poList.stream().filter(po -> list1.contains(po.getSex())).collect(Collectors.toList());
        System.out.println(poList.stream().filter(po -> list1.contains(po.getSex())).collect(Collectors.toList()));
        System.out.println(poList.stream().filter(po -> !list1.contains(po.getSex())).collect(Collectors.toList()));
        validate(poList1);
        System.out.println(poList1);


        List<Long> supportPayOnlineList = new ArrayList<>();
        supportPayOnlineList.add(1L);
        supportPayOnlineList.add(3L);
        supportPayOnlineList.add(2L);

        List<Long> itemIdList = new ArrayList<>();


        boolean flag = supportPayOnlineList.stream().sorted().map(Object::toString).collect(Collectors.joining())
                .equals(itemIdList.stream().sorted().map(Object::toString).collect(Collectors.joining()));

        System.out.println(flag);
    }

    public static void validate(List<UserPO> poList) {
        poList.add(new UserPO("YY", 30, "01", 10000000.0, "wuhan"));
    }

}
